@echo off
rem **************************************************************************
rem * pturlreplace.bat
rem * This file is part of PTurlmigration.
rem * 
rem * PTurlmigration -  http://code.google.com/p/alui-toolbox/
rem * Copyright (c) 2008-2009
rem * by Fabien Sanglier
rem *
rem * PTurlmigration is free software: you can redistribute it and/or modify
rem * it under the terms of the GNU General Public License as published by
rem * the Free Software Foundation, either version 3 of the License, or
rem * (at your option) any later version.
rem * 
rem * PTurlmigration is distributed in the hope that it will be useful,
rem * but WITHOUT ANY WARRANTY; without even the implied warranty of
rem * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
rem * GNU General Public License for more details.
rem * 
rem * You should have received a copy of the GNU General Public License
rem * along with PTurlmigration.  If not, see <http://www.gnu.org/licenses/>.
rem *
rem **************************************************************************

echo "Running ptmigration..."

:setup
rem **************************************************************************
rem * Setup PORTAL_HOME, PT_HOME, PATH, etc
rem **************************************************************************
setlocal
call "%~dp0\portalenv.bat"

:input
rem **************************************************************************
rem * User Input
rem **************************************************************************

	echo "Please enter the application name:"
    set /p appname=

    echo "Please enter portal Username:"
    set /p username=

    echo "Please enter Password: "
    set /p password=
    
    echo "Please enter the pattern to look for (regular expression):"
    set /p pattern=

    echo "Please enter the text to replace with:"
    set /p replacement=

    echo "Do you want to run in debug mode? [true/false]"
    set /p isdebug=

:start
rem **************************************************************************
rem * Start the Java process
rem **************************************************************************
echo Starting PT URL Replace Agent
set PT_LIB_DIR=%PORTAL_HOME%\lib\java

set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\openconfig.jar
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\openfoundation.jar 
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\openkernel.jar
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\openlog-framework.jar
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\plumtreeserver.jar
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\pthome.jar
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\ptportalobjects.jar  
set CLASSPATH=%CLASSPATH%;%PT_LIB_DIR%\uiinfrastructure.jar

rem Start the command-line version tool
"%PT_HOME%/common/jre/1.4.2/bin/java.exe" -cp "%PT_LIB_DIR%\PTURLMigration.jar;%CLASSPATH%" com.ppc.ptmigration.PTURLMigrate "%appname%" "%username%" "%password%" "%pattern%" "%replacement%" "%isdebug%"
goto end

:end
endlocal